package spbun.fileclean.dto;

public class CompareResult {

	private String before = null;

	private String end = null;

	private int percentBE = 0;

	private int percentEB = 0;

	public int getPercent() {
		return Math.max(percentBE, percentEB);
	}

	public CompareResult() {
		super();
	}

	public CompareResult(String before, String end) {
		this.before = before;
		this.end = end;
	}

	public String getBefore() {
		return before;
	}

	public void setBefore(String before) {
		this.before = before;
	}

	public String getEnd() {
		return end;
	}

	public void setEnd(String end) {
		this.end = end;
	}

	public double getPercentBE() {
		return percentBE;
	}

	public void setPercentBE(int percentBE) {
		this.percentBE = percentBE;
	}

	public double getPercentEB() {
		return percentEB;
	}

	public void setPercentEB(int percentEB) {
		this.percentEB = percentEB;
	}

	@Override
	public boolean equals(Object obj) {

		CompareResult cr = (CompareResult) obj;

		if (cr == this) {
			return true;
		}

		if (cr.before.equals(this.end) && cr.end.equals(this.before)) {
			return true;
		}

		return false;
	}

	@Override
	public String toString() {

		StringBuffer sb = new StringBuffer();
		sb.append("比较前目录：" + before + "\n");
		sb.append("比较后目录：" + end + "\n");
		sb.append("前在后占比：" + percentBE + "%\n");
		sb.append("后在前占比：" + percentEB + "%\n");

		return sb.toString();
	}
}
